package com.hzit.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hzit.entity.ItemCat;
import com.hzit.mapper.ItemCatMapper;
import com.hzit.service.IItemCatService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品类目 服务实现类
 * </p>
 *
 * @author wf
 * @since 2023-08-07
 */
@Service
public class ItemCatServiceImpl extends ServiceImpl<ItemCatMapper, ItemCat> implements IItemCatService {

	//1. 根据父分类id查询子分类列表
	@Override
	public List<ItemCat> findCategorysByParentId(String pid) {
		//1.1 定义查询包装器对象
		QueryWrapper<ItemCat> wrapper = new QueryWrapper<>();
		//1.2 设置查询条件
		wrapper.eq("parent_id",pid);
		return this.list(wrapper);
	}
}
